package com.tongtong;

import com.tt.hotkey.contract.IdGeneratorOptions;
import com.tt.hotkey.idgen.YitIdHelper;
import com.tt.utils.SpringContextApplication;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication
@EnableScheduling
public class MumuDaApplication implements ApplicationRunner {


    public static void main(String[] args) {
        SpringApplication.run(MumuDaApplication.class, args);
    }

    @Bean
    public SpringContextApplication springContextApplication(){
        return new SpringContextApplication();
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        IdGeneratorOptions options = new IdGeneratorOptions((short) 1);
        options.SeqBitLength = 10;
        YitIdHelper.setIdGenerator(options);
    }
}
